<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<style>
#div1{
    width:50px;
    height:50px;
    background-color:blue;

}
#div2{
    width:50px;
    height:50px;
    background-color: red;
    position:absolute;
    left:40px;
    top:40px;
}
</style>
<body>
   <div id="div1"></div> 
   <div id="div2"></div>
</body>
<script>
function count(){
    var div1=document.getElementById("div1");
    var div2=document.getElementById("div2");
    var intersection1=div1.clientWidth-(div2.offsetLeft-div1.clientLeft);
    var intersection2=div1.clientHeight-(div2.offsetTop-div1.clientTop);
    return intersection1*intersection2;
}
console.log(count());
</script>
</html>